<?php
// Remote console handling.

require_once("includes/config.php");
require_once("includes/sockets.php");
if($_GET['act']=="remoteconsole")
{
	switch($_GET['do'])
	{
	case "shutdown":
		set_time_limit(8);
		$Delay = $_GET['delay'];
		$User = $_GET['user'];
		$Pass = $_GET['pass'];
		$Server = $_GET['sid']; // NYI;
		$Sock = new Socket(); //NYI;
		$Sock->Write("$User\n$Pass\n");
		sleep(2);
		$Sock->Write("shutdown $Delay\n");
		sleep(1);
		if(!$Sock->Read())
		{
			echo "0"; 
		}
		else
		{
			echo "1";
		}
		unset($Sock);
		unset($Pass); // Unsetting var for security reasons
	}
}

?>
